package com.test.login.logic;

import com.test.login.exception.PasswordErrorException;
import com.test.login.exception.UserNotFoundException;

public class UserManager {
    private static UserManager userManager;
    
    private UserManager(){
    }
    
    public static synchronized UserManager getInstance(){
        if(userManager == null){
            userManager = new UserManager();
        }
        return userManager;
    }
    
    public void validate(String username,String password)
        throws UserNotFoundException,PasswordErrorException
    {
        if(!"admin".equals(username)){
            throw new UserNotFoundException();
        }
        if(!"admin".equals(password)){
            throw new PasswordErrorException();
        }
    }
}

